home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Grafik & Text / OzTeX3.0 / TeX-inputs / dvips / rotate.tex < prev   
Text File  |  1995-11-06  |  2KB  |  44 lines

  1. %
  2. %   These macros allow you to rotate or flip a \TeX\ box.  Very useful for
  3. %   sideways tables or upsidedown answers.
  4. %
  5. %   To use, create a box containing the information you want to rotate.
  6. %   (An hbox or vbox will do.)  Now call \rotr\boxnum to rotate the
  7. %   material and create a new box with the appropriate (flipped) dimensions.
  8. %   \rotr rotates right, \rotl rotates left, \rotu turns upside down, and
  9. %   \rotf flips.  These boxes may contain other rotated boxes.
  10. %
  11. \newdimen\rotdimen
  12. \def\vspec#1{\special{ps:#1}}%  passes #1 verbatim to the output
  13. \def\rotstart#1{\vspec{gsave currentpoint currentpoint translate
  14.    #1 neg exch neg exch translate}}% #1 can be any origin-fixing transformation
  15. \def\rotfinish{\vspec{currentpoint grestore moveto}}% gets back in synch
  16. %
  17. %   First, the rotation right. The reference point of the rotated box
  18. %   is the lower right corner of the original box.
  19. %
  20. \def\rotr#1{\rotdimen=\ht#1\advance\rotdimen by\dp#1%
  21.    \hbox to\rotdimen{\hskip\ht#1\vbox to\wd#1{\rotstart{90 rotate}%
  22.    \box#1\vss}\hss}\rotfinish}
  23. %
  24. %   Next, the rotation left. The reference point of the rotated box
  25. %   is the upper left corner of the original box.
  26. %
  27. \def\rotl#1{\rotdimen=\ht#1\advance\rotdimen by\dp#1%
  28.    \hbox to\rotdimen{\vbox to\wd#1{\vskip\wd#1\rotstart{270 rotate}%
  29.    \box#1\vss}\hss}\rotfinish}%
  30. %
  31. %   Upside down is simple. The reference point of the rotated box
  32. %   is the upper right corner of the original box. (The box's height
  33. %   should be the current font's xheight, \fontdimen5\font,
  34. %   if you want that xheight to be at the baseline after rotation.)
  35. %
  36. \def\rotu#1{\rotdimen=\ht#1\advance\rotdimen by\dp#1%
  37.    \hbox to\wd#1{\hskip\wd#1\vbox to\rotdimen{\vskip\rotdimen
  38.    \rotstart{-1 dup scale}\box#1\vss}\hss}\rotfinish}%
  39. %
  40. %   And flipped end for end is pretty ysae too. We retain the baseline.
  41. %
  42. \def\rotf#1{\hbox to\wd#1{\hskip\wd#1\rotstart{-1 1 scale}%
  43.    \box#1\hss}\rotfinish}%
  44.